# Contributor: Newbyte <newbie13xd@gmail.com>
# Maintainer: Newbyte <newbie13xd@gmail.com>
pkgname=cargo-gra
pkgver=0.3.1
pkgrel=0
pkgdesc="gtk-rust-app CLI for building Flatpak apps with ease"
url="https://gitlab.com/loers/cargo-gra"
arch="all !s390x !riscv64" # no cargo for these archies
license="GPL-3.0-or-later"
makedepends="cargo"
source="https://gitlab.com/loers/cargo-gra/-/archive/v$pkgver/cargo-gra-v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-v$pkgver"
options="!check" # Tests fail

export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_LTO="true"
export CARGO_PROFILE_RELEASE_OPT_LEVEL="s"
export CARGO_PROFILE_RELEASE_PANIC="abort"

prepare() {
	default_prepare

	env -u CARGO_NET_OFFLINE cargo fetch --locked
}

build() {
	cargo build --release --frozen
}

check() {
	cargo test --release --frozen
}

package() {
	cargo install --locked --root "$pkgdir/usr" --path .

	rm "$pkgdir"/usr/.crates.toml
	rm "$pkgdir"/usr/.crates2.json
}

sha512sums="
cbf0a231fc7a80b0a4f9fdfd92473915228dafee1c0a754ae4eda8d4ac6e307fd1657287679e58b9b0178994cdf639845c295425ec21f9d1407f3cfe2e412b31  cargo-gra-v0.3.1.tar.gz
"
